<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="test.css">
  <title>Zepto Stack unit tests</title>
  <script src="../vendor/evidence.js"></script>
  <script src="evidence_runner.js"></script>
  <script>
    // avoid caching
    (function(){
      function load(scripts){
        scripts.split(' ').forEach(function(script){
          document.write('<script src="../src/'+script+'.js?'+(+new Date)+'"></scr'+'ipt>')
        })
      }

      load('zepto stack ie')
    })()
  </script>
</head>
<body>
  <h1>Zepto Stack unit tests</h1>
  <p id="results">
    Running… see browser console for results
  </p>
  <div id="fixtures">

  <div id="end_test">
    <div class="end_one"><b><span></span></b></div>
    <div class="end_two"><b><span>1</span><span>2</span></b></div>
  </div>

  <div id="andself_test">
    <div class="one"></div>
    <div class="two"></div>
    <div class="three"></div>
    <div class="four"></div>
  </div>

  </div><!-- fixtures -->

  <script>
  (function(){

    Evidence('ZeptoTest', {

      testEnd: function (t) {
        t.assert($().end().length == 0)

        var $endTest = $('#end_test')
        var $endTest2 = $('#end_test').find('div').find('span').end().end()
        t.assertEqual($endTest.length, $endTest2.length)
        t.assertEqual($endTest.get(0), $endTest2.get(0))
      },

      testAndSelf: function (t) {
        var testDiv  = $('#andself_test'),
            secondEl = $('.two', testDiv),
            thirdEl  = $('.three', testDiv),
            nextAndSelf = secondEl.next().andSelf()

        t.assert(secondEl.get(0), nextAndSelf.get(0))
        t.assert(thirdEl.get(0),  nextAndSelf.get(1))
      }

    })

  })()
  </script>
</body>
</html>
